import requests from "./ajax"
import mockRequests from "./mockAjax"

export const reqCategoryList = () => requests({ url: '/product/getBaseCategoryList', method: 'get'})
export const reqBannerList = () => mockRequests.get('/banner')
export const reqFloorList = () => mockRequests.get('/floor')
export const reqGetSearchInfo = (params) => requests({ url: '/list', method: 'post', data: params})
export const reqGoodsInfo = (skuId) => requests({ url: `/item/${skuId}`, method: 'get' })
// 添加购物车
export const reqAddOrUpdateShortCart = (skuId,skuNum) => requests({ url: `/cart/addToCart/${skuId}/${skuNum}`, method: 'post' })

//获取购物车列表数据接口
//URL:/api/cart/cartList   method:get 
export const reqCartList = () => requests({ url:'/cart/cartList', method:'get' });

//删除购物产品的接口
//URL:/api/cart/deleteCart/{skuId}   method:DELETE  
export const reqDeleteCartById = (skuId)=>requests({url:`/cart/deleteCart/${skuId}`,method:'delete'});

//修改商品的选中状态
//URL:/api/cart/checkCart/{skuId}/{isChecked}   method:get 
export const reqUpdateCheckedByid = (skuId,isChecked)=>requests({url:`/cart/checkCart/${skuId}/${isChecked}`,method:'get'});

// 获取验证码
export const reqGetCode = (phone) => requests({url: `/user/passport/sendCode/${phone}`, method:'get'})

// 注册
export const reqUserRegister = (data) => requests({url:'/user/passport/register/',data, method: 'post'})

// 登录
export const reqUserLogin = (data) => requests({url:'/user/passport/login/',data, method: 'post'})

// 获取用户信息
export const reqUserInfo = () => requests({url:'/user/passport/auth/getUserInfo', method: 'get'})